package com.kotlin.mvpdemo.ui.mine;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.kotlin.mvpdemo.R;
import com.kotlin.mvpdemo.base.BaseFragment;
import com.kotlin.mvpdemo.databinding.FragmentMineBinding;
import com.kotlin.mvpdemo.ui.mine.presenter.MinePresenter;
import com.kotlin.mvpdemo.ui.mine.view.MineView;

/**
 * author : fang.zhang
 * e-mail : initzf@126.com
 * date   : 2020/6/6
 * desc   :
 */
public class MineFragment extends BaseFragment<MineView, MinePresenter, FragmentMineBinding> {

    private int i;

    @Override
    protected MinePresenter getPresenter() {
        return new MinePresenter();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_mine;
    }

    @Override
    protected FragmentMineBinding getViewBind(LayoutInflater inflater, ViewGroup container) {
        return FragmentMineBinding.inflate(inflater, container, false);
    }

    public static MineFragment newInstance() {

        Bundle args = new Bundle();

        MineFragment fragment = new MineFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);


        mViewBinding.btnAddNumber.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                i++;
                mViewBinding.tvShowNumber.setText("" + i);
            }
        });
    }
}
